// JavaScript Document
var lat=0,lng=0;
$(document).ready(function(){
	if($('#noticeSubmitBtn').length>0){
		$('#noticeSubmitBtn').click(postNotice);
	}
	initGEO();
});

//post Notice
function postNotice(){
	var postData={
			lat:0,
			lng:0
	};
	postData.notice=$('#noticeInput').val();
	postData.lat=lat;
	postData.lng=lng;
	var callback=function(data){
		$('#noticeContainer').prepend(data);
	};
	$.post(basePath+"/js/notice/new",postData,callback,"html");
}
//geo
function initGEO(){
	if(navigetor.geolocation){
		navigetor.geolocation.getCurrentPosition(
			function(position){
				lat=position.coords.latitude;
				lng=position.coords.longitude;
			},
			function(error){}
		);
	}
}
function getBasePath(){
	
}

function getRootPath(){
	var strFullPath=window.location.href;
	var path=strFullPath;
	path=path.substring(7,path.length);
	var index=path.indexOf("/")+7+1;
	 rootPath=strFullPath.substring(0,index); 

	//var rootPath=strFullPath.substring(0,index+1);
	return rootPath;
	}